<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->

<title>新增文章</title>
</head>
<body>
<div class="pd-20">
	<form action="" method="post" class="form form-horizontal" id="form1">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>文章标题：</label>
			<div class="formControls col-6">
				<input type="text" class="input-text" value="" placeholder="" id="article_title" name="article_title" nullmsg="文章标题不能为空！" datatype="*1-100">
			</div>
			<div class="col-3"> </div>
			<!-- <div class="btn btn-secondary-outline radius col-2">检测重复</div> -->
		</div>
		<div class="row cl">
			<label class="form-label col-2"><!-- <span class="c-red">*</span> -->状态：</label>
			<div class="formControls col-3 s-msg">
			    <div class="radio-box">
			        <input type="radio" name="article_state" value="1" checked>
			        <label for="radio-1" class="lh-26">显示</label>
			    </div>
			    <div class="radio-box">
			        <input type="radio" name="article_state" value="0">
			        <label for="radio-2" class="lh-26">不显示</label>
			      </div>
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-2"><!-- <span class="c-red">*</span> -->分类：</label>
			<div class="col-2"  id="tpl_blank"> 
				<span class="select-box">
					<select name="cid" id="cid" class="select">
						<option value="" selected="">选择分类</option>
						<option value='1'>首页头条</option>
						<option value='2'>券体验指南</option>
						<option value='3'>今日之星</option>
						<option value='4'>微商秘籍</option>

					</select>
				</span> 
			</div>
			
		</div>
		
		<div class="row cl">
			<label class="form-label col-2"><!-- <span class="c-red">*</span> -->是否封面显示：</label>
			<div class="formControls col-3 s-msg">
			    <div class="radio-box">
			        
			        <label  class="lh-26"><input type="radio" name="is_first" value="1" checked>是</label>
			    </div>
			    <div class="radio-box">
			        
			        <label class="lh-26"><input type="radio" name="is_first" value="0">否</label>
			      </div>
			</div>
		</div>
		
			
		<div class="row cl">
			<div class="col-8">
				<div class="row cl">
					<label class="form-label col-2">跳转链接：</label>
					<div class="formControls col-3">
						<input type="text" class="input-text" value="" placeholder="http://" id="article_url" name="article_url">
					</div>
					<label class="form-label col-2">点击量：</label>
					<div class="formControls col-1">
						<input type="text" class="input-text" value="" placeholder="" id="article_click" name="article_click">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2">文章摘要：</label>
					<div class="formControls col-10">
						<textarea name="article_brief" id="article_brief" cols="" rows="" class="textarea"  placeholder="文章摘要..." ></textarea>
						<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
					</div>
				</div>
			</div>


			<div class="formControls col-3" >
				<div class="l mb-10 fj-img" id="imgslt" >		
				</div>	
				<i class="Hui-iconfont fj-img-btn" onclick="_open('添加附件','article-imageupload.html?type=image&idname=imgslt&api=article&single=1&inputname=article_image','710px','470px',true)">&#xe610;</i>
			</div>
			
			
			
		</div>
		
		<div class="row cl">
			<div class="col-9">
				<!-- <div class="row cl">
					<label class="form-label col-2">关联商品：</label>
					<div class="formControls col-8" style="position: relative;">
						<input type="text" class="input-text" value="" placeholder="" id="searchshopinput" onfocus="opensearch()" onblur="setTimeout(closesearch,200)" autocomplete="off" nullmsg="运费模板不能为空！">
						<input type="hidden" name="art_gid">
						<div id="autocomplate" class="thinklist">
							
						</div>
					</div>
				</div> -->
				<!-- <div class="row cl">
					<label class="form-label col-2">跳转链接：</label>
					<div class="formControls col-8">
						<input type="text" class="input-text" value="" placeholder="http://" id="art_url" name="art_url">
					</div>
					
				</div> -->
				
			</div>
			<div class="col-2">
				
			</div>
			
		</div>
		

		<div class="row cl">
			<label class="form-label col-2">文章内容：</label>
			<div class="formControls col-10"> 
				<script id="editor" name="article_content" type="text/plain" ></script> 
			</div>
		</div>
		
		
	
		

		
</div>

<div class="row cl pr-20" style="position:fixed; bottom:10px; width: 200px; right: 10px; text-align: right; z-index:1000; ">
	
		<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
		<button onClick="removeIframe();" class="btn btn-default radius" type="button" style="margin-left:10px;">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
	
</div>
</form>

<script type="text/javascript" src="lib/layer/2.1/layer.js"></script> 

<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 
<script type="text/javascript" src="js/template-native.js"></script> 
<script type="text/javascript" src="js/s.js"></script> 

<script type="text/javascript" src="lib/daterangepicker/moment.min.js"></script> 
<script type="text/javascript" src="lib/daterangepicker/jquery.daterangepicker.js"></script>
<link rel="stylesheet" href="lib/daterangepicker/daterangepicker.css" /> 



<script type="text/javascript">


function removeIframe(){
	var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}





 
$(function(){




	$("#form1").attr("action", API_ARTICLE); 

	var editid=getUrlParam('editid');//编辑菜单id
	if(editid!==null){	     
	    var eidturl=API_ARTICLE+"?id="+editid;
	    // 读取即将编辑的文章信息
	    $.getJSON(eidturl,function(data){

	    	if(!checkStatus(data)) return;//判断登录

	    	if(data.datas==''){
	    		layer.msg("数据加载错误", {icon:2,time:1000});
	    	}else{
	            $("#article_title").val(data.datas.article_title);
	            $("#article_brief").val(data.datas.article_brief);

	            

	            $("#article_click").val(data.datas.article_click);
	            $("#article_url").val(data.datas.article_url);


	            $("#art_url").val(data.datas.art_url);
	            $("#form1").attr("action", eidturl);

	            // if(data.datas.article_image!==""){
	            // 	console.log(data.datas.article_image);
	            // 	$("#fileList").html('<img src="'+data.datas.article_image+'">');
	            // }

        		if(data.datas.article_image!==""){
                	console.log(data.datas.article_image);
                	$("#imgslt").html('<img src="'+data.datas.article_image+'"><i class="icon Hui-iconfont fun-img-del" data-id="#imgslt" data-inputname="article_image"></i><input type="hidden" name="article_image" value="'+data.datas.article_image+'">');
                }
	
	       
	            $("input[name='article_state'][value="+data.datas.article_state+"]").attr("checked",true); 
	            $("input[name='is_first'][value="+data.datas.is_first+"]").attr("checked",true); 


                $("#cid").find("option[value="+data.datas.cid+"]").attr("selected",true);
	       

	            UE.getEditor('editor').addListener('ready', function (editor) {
		            UE.getEditor('editor').setContent(data.datas.article_content);
	            });



	            
	            
	 
	        }
	    })
	}



	Validformsubmit("#form1");

	
	
	
	
	
	// 富文本编辑器
	getueidt()
	


});


// 移除选中的图片
function fj_close(obj){
	$(obj).parents("li").remove();
}


</script>
</body>
</html>